package com.bicon.base.data.rabbitmq.config;

import java.util.HashMap;
import java.util.Map;

import org.springframework.amqp.rabbit.core.RabbitMessagingTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.bicon.base.data.pojo.quartz.job.Job;

@Component
public class RabbitmqMessageSender {

	@Autowired
	private RabbitMessagingTemplate rabbitMessagingTemplate;
	
	/**
	 * 定时任务状态变更通知发送
	*/
	public boolean quartzJobUpdateMessage(Job job) {
		try {
			Map<String, Object> header = new HashMap<>();
			header.put("extraContent", "定时任务状态变更通知发送");
			this.rabbitMessagingTemplate.convertAndSend("health.indicator.job.quartz.messageexchange", "health.indicator.job.quartz.messagequeue", job, header);
			
		} catch (Exception e) {
			return false;
		}
		return true;
	}
}
